import {Navigate, createBrowserRouter} from 'react-router-dom'
import React from 'react'
import App from '@/App'
import Error from '@/views/error'
import Login from '@/views/login'
const Home = React.lazy(() => import('@/views/home'))
const Detail = React.lazy(() => import('@/views/detail'))
const Entire = React.lazy(() => import('@/views/entire'))

const router = createBrowserRouter([
   {
    path: '/',
    element: <App/>,
    errorElement: <Error/>,
    children:[
        {
            path: '/',
            element: <Navigate to={'/home'}/>
        },
        {
            path: '/home',
            element: <Home/>
        },
        {
            path: '/detail',
            element: <Detail/>
        },
        {
            path: '/entire/:type',
            element: <Entire/>
        }
    ]
   },
   {
    path: '/login',
    element: <Login/>
   }
])

export default router